package com.android.demo_20220829.ui.activity;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.android.baselibrary.ui.AbsBaseActivity;
import com.android.baselibrary.view.Comm_HeadView;
import com.android.demo_20220829.R;
import com.gyf.immersionbar.ImmersionBar;

public abstract class BaseActivity extends AbsBaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Comm_HeadView comm_title = findViewById(R.id.comm_title);
        if (comm_title != null) {
            comm_title.setLeftClickFinish(this);
        }
        //是否沉浸式
        if (isImmersion()) {
            if (getImmersionTitleBar() != null) {
                ImmersionBar.with(this).titleBar(getImmersionTitleBar());
            }
            ImmersionBar.with(this).statusBarDarkFont(true).navigationBarDarkIcon(true).init();
        }
    }

    protected boolean isImmersion() {
        return true;
    }

    protected View getImmersionTitleBar() {
        Comm_HeadView comm_title = findViewById(R.id.comm_title);
        return comm_title;
    }

//    @Subscribe(threadMode = ThreadMode.MAIN)
//    public void onEventMainThread(Event_Token_Failure event) {
//        if (this.getClass().getSimpleName().equals(MainActivity.class.getSimpleName())||
//                this.getClass().getSimpleName().equals(LoadingActivity.class.getSimpleName())) {
//            UserManager.logout((Activity) mContext);
//            UserManager.toLogin(this);
//            finish();
//        } else if(!this.getClass().getSimpleName().equals(LoginActivity.class.getSimpleName())){
//            finish();
//        }
//    }


}
